#{if _display == 'details'}
	<article class="details" itemscope itemtype="http://schema.org/Recipe">
		<div class="#{if _recipe.image2}recipeImgTwo#{/if}#{else}recipeImg#{/else}">
			<a href="@{Application.recipeImage(_recipe.code)}"><img itemprop="image"
				src="@{Application.recipeThumb(_recipe.code)}" alt="${_recipe.name}" title="${_recipe.name}"/></a>
			#{if _recipe.image2}
			<a href="@{Application.recipeImage2(_recipe.code)}"><img itemprop="image"
				src="@{Application.recipeThumb2(_recipe.code)}" alt="${_recipe.name}" title="${_recipe.name}"/></a>
			#{/if}
		</div>
		<h3 itemprop="name">${_recipe.name}</h3>
		#{if _recipe.author}
		<p>
			Автор<span itemprop="author">${_recipe.author}</span>
		</p>
		#{/if} Ингредиенты:
		<table class="ingredients table">
			#{list items: _recipe.ingredients.order("unit").fetch(), as: 'ingredient' }
			%{ingredient.product.get();}%
			<tr>
				<td itemprop="ingredients">${ingredient.product.name}</td>
				#{if ingredient.unit != models.Ingredient.Unit.NONE}<td>#{count ingredient: ingredient/}</td>#{/if}
			</tr>
			#{/list}
		</table>
		<br class="clear" /> <a class="backToRecipesLink"
			href="@{Application.recipes()}">&larr; Назад к списку</a> <br
			class="clear" /> <br class="clear" /> Описание:
		<div class="recipeDescription" itemprop="recipeInstructions">${_recipe.description.raw()}</div>

		<h4 id="comments">#{if _recipe.comments.fetch().size() > 0}Комментарии к рецепту '${_recipe.name}':#{/if}#{else}Комментариев к рецепту '${_recipe.name}' пока нет.#{/else}</h4>
		#{list items: _recipe.comments.fetch(), as: 'comment'}
		<div class="comment well">
			<div class="comment-metadata">
				<span class="comment-author">${comment.name},</span> <span
					class="comment-date">${comment.dateCreated.format('dd.MM.yyyy')}</span>
			</div>
			<div class="comment-content">${comment.comment?.escape()}</div>
		</div>
		#{/list}

		#{gae.ifLoggedIn}
			<input id="open-comment-form-btn" type="button" class="btn btn-primary" onclick='javascript:$("#comment-form").show();$(this).animate({"opacity":"0"},200, function(){$("#comment-form").animate({"opacity":"1"}, 200)});' value="Оставить комментарий"/>
			#{form @Application.addRecipeComment(), class:'form-horizontal', id:'comment-form'}
			<input type="hidden" name="id" value="${_recipe.id}"/>
			<fieldset>
				<legend>Комментировать рецепт:</legend>
				<div class="control-group">
					<label class="control-label" for="name">Имя:</label>
					<div class="controls">
						<input type="text" name="name" value="#{gae.user/}" class="input-xlarge" disabled="true"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="comment">Комментарий:</label>
					<div class="controls">
						<textarea rows="10" cols="20" class="input-xlarge" name="comment">${flash.comment}</textarea>
						<p class="help-block">Обязательное</p>
						#{ifError 'comment'}<span class="alert-message error">#{error 'comment'/}</span>#{/ifError}
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<input type="submit" class="btn btn-primary" value="Комментировать"/>
				<input type="button" class="btn" value="Отменить" onclick="javascript:$('#comment-form').animate({'opacity':'0'}, 400, function(){$('#comment-form').hide();$('#open-comment-form-btn').animate({'opacity':'1'}, 400);});"/>
			</div>
			#{/form}
		#{/gae.ifLoggedIn}
		#{else}
			<a href="@{Application.login(request.action, recipeCode)}">Авторизуйтесь</a> чтобы комментировать.
		#{/else}
	</article>
#{/if}
#{else}
	#{if _display == 'list'}
		<article class="list" itemscope itemtype="http://schema.org/Recipe">
			<div class="recipeImg">
			<a href="@{Application.viewRecipeByCode(_recipe.code)}"><img itemprop="image"
				src="@{Application.recipeThumb(_recipe.code)}" alt="${_recipe.name}" title="${_recipe.name}"/></a></div>
			<div class="ingredient-desc">
				<h3 itemprop="name"><a href="@{Application.viewRecipeByCode(_recipe.code)}">${_recipe.name}</a></h3>
				#{if _recipe.author}
				<p>
					Автор<span itemprop="author">${_recipe.author}</span>
				</p>
				#{/if}
				Ингредиенты:
				<ul class="ingredients-small">
					%{ingredients = _recipe.ingredients.fetch();}%
					#{list items: ingredients, as: 'ingredient' }
					%{ingredient.product.get()}%
					#{if ingredient_index < 4 || ingredients.size() == 4}
						<li itemprop="ingredients">${ingredient.product.name}</li>
					#{/if}
					#{elseif ingredient_index == 4}
						<li>...</li>
					#{/elseif}
					#{/list}
				</ul>
				<span><a href="@{Application.viewRecipeByCode(_recipe.code)}#comments">#{if _recipe.comments.fetch().size() > 0}Комментариев: ${_recipe.comments.fetch().size()}#{/if}#{else}Комментировать рецепт#{/else}</a></span>
			</div>
		</article>
	#{/if}
#{/else}